<?php 
session_start();
require_once("include/authen.php");
require_once("include/ui.php");
if (!(isset($_POST['type']))){
	  echo "<script>window.location='order.php'</script>";
} 
if ($_POST['type']=='d'){
	$title="Order Product Detail";
	$colspan=6;
}else if ($_POST['type']=='c'){
	$title="Order Product Detail [Check]";
	$colspan=8;
}else if ($_POST['type']=='cl'){
	$title="Order Product Detail [Confirm]";
	$colspan=8;
}else if ($_POST['type']== 'vcl'){
	$title="Order Product Detail [Closed]";
	$colspan=8;
}else{
	$title="Order Product";
	$colspan=7;
}
$Is_HO=$_SESSION['branchtype'];

echo headerPage("Order Product Details");

?>
<SCRIPT src="js/jquery.numeric.js"></script>
<SCRIPT src="js/js_order_v.js"></SCRIPT> 
 <script>
$(function() {
	
	$("#btnPrint").live('click',function(){
		$("#normal-screen").hide();
		$("#page-header").hide();
		 
		$(".toolbar-box").hide();
		$("#foolter_table").hide();
		$("#leftboder").hide();
		$("#rightboder").hide();
		window.print();
		
		$("#normal-screen").show();
		$("#page-header").show();

		$(".toolbar-box").show();
		$("#foolter_table").show();
		$("#leftboder").show();
		$("#rightboder").show();
	});	
});
</script>
<FORM name="Act" action="<?php echo $PHP_SELF?>" method="post"> 
<INPUT type=hidden value="<?php echo $_POST['reID']?>" id="val" name="val"> 
<INPUT type=hidden value="<?php echo $_POST['type']?>" id="mode" name="mode"> 
<INPUT type=hidden value="<?php echo $_POST['branch']?>" id="branch" name="branch"> 
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" id='leftboder' style='border-left:2px solid #facb0c;'>&nbsp;</td>
    <td width="1004" valign="top">
        <div class="content-box">
            <div Class="toolbar-box">   
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                 </div>
                 <div class="m">
                    <div class="toolbar">
                        <table class="toolbar">
                        <tr>
						<?php  if (($_POST['type']=='d')  && ($_SESSION["permission"][$orderScreen]["Edit"]=="1")){  ?>
							<td><a href="javascript:void('0');" id="btnSend">
								<span class="icon_check"></span>Order
								</a>
							</td>
						<?php  }else if (($_POST['type']=='c') && ($_SESSION["permission"][$orderScreen]["Edit"]=="1")){ ?>
							<td><a href="javascript:void('0');" id="btnCheck">
								<span class="icon_check"></span>Check
								</a>
							</td>
						<?php }else if (($_POST['type']=='cl')  && ($_SESSION["permission"][$orderScreen]["Edit"]=="1")) { ?>
							<td><a href="javascript:void('0');" id="btnConfirm">
								<span class="icon_check"></span>Confirm
								</a>
							</td>
						<?php }?>
                            <td><a href="javascript:void('0');" id="btnBack">
								<span class="icon_back"></span>Back
								</a>
							</td>
					        <td>
								<a href="javascript:void('0');" title="Print" id="btnPrint">
								<span class="icon_Print"></span>Print
								</a>
							</td>
                        </tr>
                        </table>
                    </div>
                      <div class="header" style="background-image: url(images/return.png);">
						Order Product Detail 
                      </div>
                <div class="clr"></div>
                 </div>
                 <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                 </div>
            </div>
               <div id="element-box">
                <div class="t">
					<div class="t">
						<div class="t"></div>
					</div>
				</div>
                <div class="m">
				<fieldset  class="ui-widget ui-widget-content">
				<legend>Order Product Information</legend>	
                    <table width="100%"  id="infotable" style="line-height:25px">
                        <tr>
                          <td width="25%" class="fontSearch" style="padding-left:20;font-weight:bold;"><label for="name">&nbsp;&nbsp;Order No : </label><span id="iCode" style="font-weight:normal;"></span></td>
							 <td width="40%" class="fontSearch" style="padding-left:20;font-weight:bold;">Branch Name : <span id="iName" style="font-weight:normal;"></span></td>
							 <td width="35%" class="fontSearch" style="padding-left:20;font-weight:bold;">Status : <span id="iStatus" style="font-weight:bold;color:red"></span></td>
						</tr>
                        <tr>
                            <td width="20%" class="fontSearch" style="padding-left:20;font-weight:bold;">&nbsp;&nbsp;Created Date :
								<span id="dtCreatedDate" style="font-weight:normal;"></span>
							</td>
							<td width="20%" colspan="2" class="fontSearch" style="padding-left:20;font-weight:bold;">Created By : 
								<span id="lblCreatedBy" style="font-weight:normal"></span>
							</td>
						</tr>	
                        <tr id="iRowOrderDate" style="display:none">
                           <td width="20%" class="fontSearch" style="padding-left:20;font-weight:bold;">&nbsp;&nbsp;Order Date : 
							<span id="dtODate" style="font-weight:normal;"></span>
						   </td>
							<td width="20%" colspan="2" class="fontSearch" style="padding-left:20;font-weight:bold;" >Order By : 
								<span id="lblOBy" style="font-weight:normal;"></span>
							</td>
						</tr>	
						<tr id="iRowConfirmDate" style="display:none">
                           <td width="20%" class="fontSearch" style="padding-left:20;font-weight:bold;">&nbsp;&nbsp;HO-Confirm Date : 
							<span id="dtConfirmDate" style="font-weight:normal;"></span>
						   </td>
							<td width="20%" colspan="2" class="fontSearch" style="padding-left:20;font-weight:bold;" >HO-Confirm By : 
								<span id="lblConfirmBy" style="font-weight:normal;"></span>
							</td>
						</tr>	
						<tr  id="iRowCloseDate" style="display:none">
                           <td width="20%" class="fontSearch" style="padding-left:20;font-weight:bold;">&nbsp;&nbsp;Closed Date : 
							<span id="dtClosedDate" style="font-weight:normal;"></span>
						   </td>
							<td width="20%" colspan="2" class="fontSearch" style="padding-left:20;font-weight:bold;" >Closed By : 
								<span id="lblClosedBy" style="font-weight:normal;"></span>
							</td>
						</tr>	
                    </table>
				</fieldset>
				<p></P>
                    <table cellspacing="1" id="resultData" class=list>
                    <thead>
                       <tr>
						<th width="5%" >No.</th>
						<th width="0" style="display:none;">id</th>	<!--order detail ID-->		
						<th width="0" style="display:none;">pid</th>	<!--Product ID-->		
						<th class="title" width="30%" >Product</th>
						<th  class="title" width="15%"  nowrap="nowrap">Category</th>
						<th  class="title" width="10%"  nowrap="nowrap">Product Type</th>
						<th  class="title" width="10%"  nowrap="nowrap">Unit</th>
						<th  class="title" width="10%"  nowrap="nowrap">Remain / Order</th>
						<?php  if ($_POST['type']=='c'){?>
							<th  class="title" width="12%"   nowrap="nowrap">Check-Amt</th>
							<th  class="title" width="8%"   nowrap="nowrap">Reserve-Amt</th>
						<?php  }else if ($_POST['type']=='vc'){?>
							<th  class="title" width="10%"   nowrap="nowrap">HO-Amt</th>
						<?php }else if ($_POST['type']=='cl' || $_POST['type']=='vcl' ){?>
							<th  class="title" width="10%"   nowrap="nowrap">HO-Amt</th>
							<th  class="title" width="10%"   nowrap="nowrap">Confirm-Amt</th>
						<?php }?>
                      </tr>
                    </thead>
                   <tbody>
                   </tbody>
                   <tfoot>
                         <tr>
							<td colspan="<?php echo $colspan?>">
								<div class="boxfooter">
									 <div class="totalpage">Total : <span id="rowCount">0</span>&nbsp;&nbsp;rows</div>
									 <div id="paging_button"> 
									 </div> 
								 </div>
							</td>
                         </tr>
                     </tfoot>
                    </table>
                  <div class="clr"></div>
                </div>
                 <div class="b"><div class="b"><div class="b"></div></div></div>
                 <div class="clr"></div>
                </div> <!-- elementbox-->
        </div>
    </td>
    <td width="10" id='rightboder' style="border-right:2px solid #facb0c;">&nbsp;</td>
  </tr>
</table>
 <div id="dialog-confirm" title="Confirm order?">
	<p><span class="ui-icon ui-icon-alert" 
		style="float:left; margin:0 7px 20px 0;">
		</span>
			<?php  if($_POST['type']=='d'){ 
				echo "Confirm to send  these order product  to Head Office?";
			}else if ($_POST['type']=='cl'){
				echo "Confirm receive product from Head Office?";
			}else{
				echo "Confirm send these product?" ;}?>
		</p>
</div>
 </FORM>

<?php  echo footer();?>